package java.util
{
	import flash.utils.Dictionary;
	
	public class Hashtable
	{
		// uses Dictionary now instead of Object hash
		//private var _table:Object = new Object();
		private var _size:uint;
		private var _table:Dictionary;
		private var _weakRefs:Boolean;
		
		public function Hashtable(useWeakRefs:Boolean=false) {
			_weakRefs = useWeakRefs;
			_table = new Dictionary(_weakRefs);
		}
		
		public function get(key:Object):Object {
			return _table[key];
		}
		
		public function put(key:Object, value:Object):void {
			if(!_table[key]) { _size++; }
			_table[key] = value;
		}
		
		public function clear():void {
			_table = new Dictionary(_weakRefs);
			_size = 0;
		}
		
		public function size():int {
			return _size;
		}

		public function remove(key:Object):void {
			//_table[key] = null;
			delete _table[key];
			_size--;
		}

	}
}